The U.S. Pat. No. 7,268,354 B2 discloses an X-ray detector with a plurality of detector elements for counting incident X-ray photons. In order to improve the linearity of the detector elements, correction factors are determined in advance. A problem of this approach is that the behavior of the detector may drift over time such that the determined correction factors may become inappropriate.